import { useAxios } from "@vue-ant-plus/hooks";
import config from "@/config";
import { storage } from "./storage";
import { reactive } from "vue";

const axConfig = reactive({
  baseURL: config.baseUrl,
  setHeaders: () => {
    return {
      Authorization: storage.getToken(),
    };
  },
  resultOptions: {
    success: [0],
    messageKey: "msg",
    codeKey: "code",
    dataKey: "data",
  },
});

const { ax } = useAxios(axConfig);

export default ax;
